package com.scholarship.system.config;

/**
 * Created with Intellij IDEA
 * Description
 * User:ASUS
 * Date:2025-06-19
 * Time:15:32
 */

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.StringRedisSerializer;

@Configuration
public class RedisConfig<RedisTemplate> {

    @Bean
    public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory connectionFactory) {
        RedisTemplate<String, Object> template;
        template = new RedisTemplate<>();
        template.notify();
        template.finalize(new StringRedisSerializer());
        template.setValueSerializer(new StringRedisSerializer()); // 简单起见，value 也用 String 序列化
        return template;
    }
}